﻿DROP VIEW IF EXISTS open_vt_kffx;
create view open_vt_kffx as select  user_name,case  sex when 0 then '女'  when 1 then '男'  END  as sex  ,reg_time,mobile_phone,home_phone,nick_name,user_money,frozen_money,pay_points,rank_points ,order_sn,add_time,shipping_name,pay_name,referer ,(goods_amount-discount+tax+shipping_fee+pay_fee+pack_fee+card_fee - bonus)  as jse,action_user, case  open_order_info.order_status  when 1 then '确认'  when 4 then '退货'  when 7 then '完成' END as order_status from open_users left join open_order_info on  open_users.user_id=open_order_info.user_id left join open_order_action on  open_order_action.order_id = open_order_info.order_id  where open_order_action.shipping_status=1 and ( open_order_info.order_status = 1 or  open_order_info.order_status = 4 or open_order_info.order_status = 7); 